package com.xiaotu.test;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.alibaba.fastjson.JSONObject;
import com.xiaotu.common.model.MaoYanAccountBoxModel;
import com.xiaotu.common.model.MaoYanMovieBasicInfoModel;
import com.xiaotu.common.util.GsonUtils;
import com.xiaotu.server.service.maoyan.MaoYanMovieBasicInfoService;

import redis.clients.jedis.Jedis;

public class RefreshRedisData {
	public static void main(String[] args) {
		
		//ApplicationContext context = new ClassPathXmlApplicationContext("classpath:application-context.xml");
		
		//MaoYanMovieBasicInfoService bean = context.getBean("maoYanMovieBasicInfoService", MaoYanMovieBasicInfoService.class);
		
		//List<Map<String,Object>> list = bean.queryMovieBasicInfoList2();
		
		Jedis jedis = new Jedis("127.0.0.1",6379);
		jedis.select(3);
//		for(int i=0;i<list.size();i++) {
//			Map<String,Object> model = list.get(i);
//			System.out.println( GsonUtils.toJson(model));
//			jedis.hset("MAOYAN_SEARCH_MOVIE_BAK", model.get("dataid")+"", GsonUtils.toJson(model));
//		}
		MaoYanAccountBoxModel model1 = new MaoYanAccountBoxModel
				("246497", "花样厨神", "241.3万", "103.5万", "186.8万", 
						"", "241.3万", "88.5万", "126.1万", "26.7万");
		jedis.hset("MAOYAN_ACCOUNT_BOX", "246497_花样厨神", GsonUtils.toJson(model1));
		MaoYanAccountBoxModel model2 = new MaoYanAccountBoxModel
				("341749", "我不是潘金莲", "4.82亿", "7027.3万", "2.05亿", 
						"4.83亿", "4.82亿", "1.82亿", "2.51亿", "4792.6万");
		jedis.hset("MAOYAN_ACCOUNT_BOX", "341749_我不是潘金莲", GsonUtils.toJson(model2));
		MaoYanAccountBoxModel model3 = new MaoYanAccountBoxModel
				("78253", "诡拼车", "192.5万", "38.4万", "112.0万", 
						"192.5万", "70.6万", "100.6万", "126.1万", "21.3万");
		jedis.hset("MAOYAN_ACCOUNT_BOX", "78253_诡拼车", GsonUtils.toJson(model3));
		MaoYanAccountBoxModel model4 = new MaoYanAccountBoxModel
				("246390", "从你的全世界路过", "8.13亿", "7402.8万", "3.11亿", 
						"", "8.13亿", "3.11亿", "4.24亿", "7697.9万");
		jedis.hset("MAOYAN_ACCOUNT_BOX", "246390_从你的全世界路过", GsonUtils.toJson(model4));
		System.out.println("执行完毕");
		
		jedis.close();
		
	}
}
